<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="${pageContext.request.contextPath }/statics/js/jquery-1.8.3.min.js" type="text/javascript"></script>
</head>
<body>
	<form action="${pageContext.request.contextPath }/saveans.html" id="cform">
	<input type="hidden" id="qid" name="id" value="${question.id}">
	<table border="1" align="center" cellpadding="0" cellspacing="0">
		<tr align="center">
			<td>问题</td>
			<td style="background-color: green">${question.title }</td>
		</tr>
		
		<tr align="center">
			<td>问题描述</td>
			<td style="background-color: green">${question.detailDesc }</td>
		</tr>
		
		<tr align="center">
			<td rowspan="1">网友回答</td>
			<td style="background-color: green">
			<c:if test="${question.ansList ==null }">
				没有答案
			</c:if>
			<c:if test="${question.ansList !=null }">
				
				<c:forEach var="ans" items="${question.ansList }">
					<br>
					${ans.ansDate } <br>
					${ans.ansContent }
				</c:forEach>
				
			</c:if>
			</td>
		</tr>
		
		<tr align="center">
			<td>我来回答</td>
			<td><textarea id="ansContent" name="ansContent"></textarea></td>
		</tr>
		<tr align="center">
			<td colspan="2"><input type="button" value="提交答案" id="btns" onclick="saveans();">
			<a href="${pageContext.request.contextPath }/qlist.html">返回首页</a></td>
		</tr>
	</table>
	</form>
</body>
<script type="text/javascript">
	function saveans(){
		if($("#ansContent").val()==null || $("#ansContent").val()==''){
			alert("必须填写您的答案");
		}else{
			$("#cform").submit();
		}
	}
</script>
</html>